<%--
  Created by IntelliJ IDEA.
  User: a'su's
  Date: 2021/9/19
  Time: 17:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.11.1.js"></script>
    <script>
        $(function () {
            $("#btn").click(
                function () {
                    $.ajax({
                        type:"POST",
                        url:"/str2",
                        data:{username:"张三",password:"123"},
                        success:function (data) {
                            alert(data);
                            var str = "";
                            for (var i=0;i<data.length;i++){
                                var obj = data[i];
                                str += "id:"+obj.teamId+",name:"+teamName+"<br>";
                            }
                            $("#res").html(str);
                        }
                    });
                }
            );
        });
    </script>
</head>
<body>
    <form method="post">
        <button type="button" id="btn">提交ajax请求获取list集合</button>
    </form>
    <p id="res"></p>
</body>
</html>
